package com.zone.demo.domain.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zone.demo.domain.entity.Myuser;
import org.apache.ibatis.annotations.Select;
import org.mapstruct.Mapper;

/**
 * <p>
 * mapper 接口
 * </p>
 *
 * @author MMinbo
 * @since 2019-10-25
 */
@Mapper
public interface MyuserMapper extends BaseMapper<Myuser> {

	/**
	* Description 通过名字获取用户
	* @author shao
	* @param name
	* @date 2021/7/8 13:18
	* @return com.zone.demo.domain.entity.Myuser
	*/


	@Select("SELECT FROM MYUSER WHERE NAME = #{name}")
	 Myuser getUserByName(String name);

	/**
	* Description 添加用户
	* @author shao
	* @param id
	* @param name
	* @param age
	* @param email
	* @date 2021/7/8 13:18
	* @return void
	*/
	@Select("INSERT INTO MYUSER(ID,NAME,AGE,EMAIL) VALUES(#{id},#{name},#{age},#{email})")
	 void addUser(Long id,String name, int age ,String email);

	/**
	* Description 通过id获取用户
	* @author shao
    * @param id
	* @date 2021/7/8 13:17
	* @return com.zone.demo.domain.entity.Myuser
	*/
	 @Select("SELECT * FROM MYUSER WHERE ID = #{id}")
	 Myuser getUserById(Long id);

	/**
	* Description 通过名字删除用户
	* @author shao
    * @param name
	* @date 2021/7/8 13:17
	* @return void
	*/
	@Select("DELETE MYUSER WHERE NAME = #{name}")
	 void deleteUserByName(String name);

	/**
	* Description 通过id更新用户
	* @author shao
	 * @param id
	 * @param name
	 * @param age
	 * @param email
	* @date 2021/7/8 13:16
	* @return void
	*/
	@Select("UPDATE MYUSER SET NAME= #{name},AGE = #{age},EMAIL = #{email} WHERE ID = #{id})")
	 void updateUserById(Long id ,String name, int age ,String email);



	/**
	* Description 加法函数
	* @author shao
	* @param initial
	* @param loop
	* @date 2021/7/8 13:18
	* @return int
	*/
	public int add(int initial,int loop);



}
